package cn.jx.asc.common.untils;

public class StringToTimeUtils {
    /**
     * @author LaiWeiXing
     * @date 2018/7/5 9:58
     * @describe 将终端数据转换成time
    */
    public static String[] stringToTime(String s){
        String startTime = "";      //开始时间
        String stopTime = "";       //终止时间
        startTime += s.charAt(0);
        startTime += s.charAt(1);
        startTime += ":";
        startTime += s.charAt(2);
        startTime += s.charAt(3);
        startTime += ":00";
        stopTime += s.charAt(4);
        stopTime += s.charAt(5);
        stopTime += ":";
        stopTime += s.charAt(6);
        stopTime += s.charAt(7);
        stopTime += ":00";
        String interVal = s.charAt(8)+""; //间隔天数
        String[] str = {startTime ,stopTime ,interVal};
        return str;
    }

    /**
     * @author LaiWeiXing
     * @date 2018/7/5 9:59
     * @describe 将时间段转换成字符串
    */
    public static String timeToString(String times){
        String[] split = times.split(":");
        String str = "";
        if(!times.equals("nullnullnull")){
            for(int i=0;i<split.length;i++){
                str += split[i];
            }
        }else{
            str = "000000000";
        }
        return str;
    }
}
